/*
 * 
 * 话费产出   日产出详情
 * 
 */

$(function(){
	loadDatas();
	
	//初始化日期控件
  	$('#bt, #et').datetimepicker({
  		language: 'zh-CN',
	    format: 'yyyy-mm-dd',
	    autoclose: true,
	    minuteStep: 1,
	    minView: "month"
	});
});

function findAll(){
	$("#begin_time, #end_time").val("");
	loadDatas();
}

//查询数据
function loadDatas(){
	var begin = $("#begin_time").val();
	var end = $("#end_time").val();
	
	$.ajax({
		type: "post",
		data: {"begin":begin, "end":end},
		url: "../../../php/charts/huaFeiOutPut/loadDayHuaFeiOutPutDetail.php",
		beforeSend: function(){
			$("#load").css("display","block");
		},
		success: function(msg){
			$("#load").css("display","none");
			//表格数据
			var datas = msg.records;
			var html = "";
			if(datas.length == 0){
				html += "<tr><td colspan='14' align='center'>没查询到符合条件的数据~</td></tr>";
			}else{
				for(var i = 0; i<datas.length; i++){
					html += "<tr>";
					html += "<td>"+datas[i].time+"</td>";//时间
					html += "<td>"+datas[i].rmb+"</td>";//产出值（元）
					html += "<td>"+datas[i].counts+"</td>";//产出量
					html += "<td>"+datas[i].counts1+"</td>";//1元产出量
					html += "<td>"+datas[i].counts2+"</td>";//2元产出量
					html += "<td>"+datas[i].counts5+"</td>";//5元产出量
					html += "<td>"+datas[i].counts10+"</td>";//10元产出量
					html += "<td>"+datas[i].counts20+"</td>";//20元产出量
					html += "<td>"+datas[i].counts50+"</td>";//50元产出量
					html += "<td>"+datas[i].counts100+"</td>";//100元产出量
					html += "<td>"+datas[i].counts200+"</td>";//200元产出量
					html += "<td>"+datas[i].counts500+"</td>";//500元产出量
					html += "<td>"+datas[i].counts1000+"</td>";//1000元产出量
					html += "<td><a href='javascript:void();' onclick='goUserInfoCount(\""+datas[i].time+"\")' title='查看当天详情'>详情</a></td>";//1000元产出量
					html += "</tr>";
				}
			}
			$("#databody").html(html);
			//统计数据
			$("#allRmb").html("￥"+msg.allRmb);
			$("#allCounts").html(msg.allCounts);
		}
	});
}

//查看详情
function goUserInfoCount(time){
	window.location.href = 'userInfoCount.html?time="'+time+'"';
}
